Open
Conversation
Add <IsPackable>false</IsPackable> to example .csproj files to prevent packing sample projects. Affected files: - examples/Meow.Common/Meow.Common.csproj - examples/Meow/Meow.csproj - examples/SampleUsingLocalApi/ConsoleApplication/ConsoleSampleUsingLocalApi.csproj - examples/SampleUsingLocalApi/LibraryWithSDKandRefitService/LibraryWithSDKandRefitService.csproj - examples/SampleUsingLocalApi/RestApiforTest/RestApiForTest.csproj
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2064 +/- ##
==========================================
+ Coverage 82.68% 82.74% +0.06%
==========================================
Files 36 36
Lines 2731 2742 +11
Branches 442 442
==========================================
+ Hits 2258 2269 +11
Misses 371 371
Partials 102 102 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Fix #1959
What is the current behavior?
#1959
What is the new behavior?
This pull request introduces support for correct polymorphic serialization when using
System.Text.Jsonwith Refit, ensuring that request bodies are serialized using the declared method parameter type rather than the runtime type. This preserves type discriminators and improves compatibility withJsonPolymorphicandJsonDerivedTypeattributes. The changes also include new tests to verify this behavior and a refactor of the test HTTP handler for asynchronous operation.Polymorphic Serialization Improvements
System.Text.Jsonpolymorphism features like[JsonPolymorphic]and[JsonDerivedType]are respected and type discriminators are preserved in outgoing payloads (RequestBuilderImplementation.cs).README.md.Testing Enhancements
RestService_SerializesBodyUsingDeclaredPolymorphicBaseType, to verify that the correct type discriminator is included in serialized request bodies for polymorphic types. This includes new test models and API interfaces.StubHttpMessageHandlerto support asynchronous response delegates, enabling more flexible and accurate test scenarios. [1] [2] [3]Internal Refactoring
RequestBuilderImplementation.csto handle serialization based on the declared body type, using reflection to invoke the correct generic method.What might this PR break?
Please check if the PR fulfills these requirements
Other information: